package com.wwd;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

@SpringBootApplication
public class App 
{
	
    public static void main(String[] args )
    {
    	Building bu=(Building)SpringApplication.run(App.class).getBean(Building.class);
    	bu.build(args[0], args[1]);
    }
    
    @Bean
    public RedisTemplate<Object,Object> getTemplate(JedisConnectionFactory factory) {
    	RedisTemplate<Object,Object> temp = new RedisTemplate<Object,Object>();
    	temp.setConnectionFactory(factory);
    	return temp;
    }
    
    @Bean
    public JedisConnectionFactory jedsConn() {
    	RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
    	config.setHostName("192.168.9.229");
    	//config.setPassword(RedisPassword.of("wwd6"));
    	config.setPort(6380);
    	JedisConnectionFactory fa=new JedisConnectionFactory(config);
    	
    	return fa;
    }

}
